<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>call-apply-bind</title>
</head>
<body>
   
    <script>
        // 'use strict'
        //声明一个函数
        function add(a, b){
            console.log(this);
            console.log(a + b);
        }

        // add(1, 2);
        // add.call(undefined, 1, 2);
        // add.apply(null, [1,2]);
        // add.apply({name: '四字弟弟'}, [1,2]);

        //bind 只能修改一次函数运行时的 this
        var fn = add.bind({name: '四字弟弟'});
        var fn2 = fn.bind({name: '王俊凯'});

        fn2();

    </script>
</body>
</html>